home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-10-18 | 20.4 KB | 738 lines | [TEXT/MMCC] |
- /*
- File: GXWindow.cp
-
- Contains: The prototype GX window
-
- Written by: Jon Summers
-
- Copyright: © 1994 by Jon Summers, all rights reserved.
-
- Change History (most recent first):
-
- */
-
- #include "GXDocWindow.h"
- #include "GXDocFile.h"
- #include "GXToolWindow.h"
- #include "AppLib.h"
-
- TGXDocWindow::TGXDocWindow()
- :
- #if qUseQuickDrawGX
- fDocJob( nil),
- fPage(nil),
- #endif // qUseQuickDrawGX
- fPagesInDoc(0),
- fDocPageNum(0)
- {
- short aCount = kMaxPageFormats;
-
- while (aCount--)
- fPageFormats[aCount] = nil;
-
-
- #if qUseQuickDrawGX
-
- if (fWindow)
- {
- gxViewPort aWindowViewPort;
- gxViewPort aContentViewPort;
- gxMapping aContentMapping;
- gxShape aContentViewPortShape;
- gxShapeAttribute aContentViewPortShapeAttribute;
- Rect aPortRect = fWindow->portRect;
- gxRectangle aViewRect;
-
- // Inset the shape...
- aViewRect.top = ff(aPortRect.top + kHeaderHeight);
- aViewRect.bottom = ff(aPortRect.bottom - kScrollbarWidth);
- aViewRect.right = ff(aPortRect.right - kScrollbarWidth);
- aViewRect.left = ff(aPortRect.left);
-
- GXIgnoreGraphicsNotice(transform_already_set); // <<••
- aWindowViewPort = GXNewWindowViewPort(fWindow);
-
- GXValidateViewPort(aWindowViewPort);
- // Create a child port for scrolling the page shape: IM-QD GX Objects pp 7-45, 7-46
- aContentViewPort = GXNewViewPort(GXGetViewPortViewGroup(aWindowViewPort));
- fContentViewPort = aContentViewPort;
- (void)GXGetViewPortMapping(aContentViewPort, &aContentMapping);
- (void)MoveMappingTo(&aContentMapping, kHeaderHeight, 0);
- GXSetViewPortMapping(aContentViewPort, &aContentMapping);
- GXSetViewPortParent(aContentViewPort, aWindowViewPort);
- SetDefaultViewPort(aContentViewPort);
- GXPopGraphicsNotice(); // <<••
- this->ResetContentClip();
-
- // Create the page shape. We set the unique items attribute to make sure that each item
- // added to the picture has a unique reference. If this attribute was not set, we would
- // not see all copies of anything we add to the shape multiple times -- we'd just see
- // the last version added.
-
- aContentViewPortShape = GXNewShape(gxPictureType);
- GXValidateShape(aContentViewPortShape);
- aContentViewPortShapeAttribute = GXGetShapeAttributes(aContentViewPortShape);
- aContentViewPortShapeAttribute |= gxUniqueItemsShape;
- GXSetShapeAttributes(aContentViewPortShape, aContentViewPortShapeAttribute);
- GXValidateShape(aContentViewPortShape);
- fPage = aContentViewPortShape;
- }
- else
- SysBeep(10);
- // Create a print job for this document. This will be the same as the system default until
- // the user goes through the dialogs for Page Setup or Print…
- if (GXNewJob(&fDocJob) == noErr)
- {
- // Now install our application override for PrintingEvent so that we can
- // support the new movable-modal printing dialog boxes.
- GXInstallApplicationOverride(fDocJob, gxPrintingEvent, gAppPrintingOverrideUPP);
- }
- else
- fDocJob = nil;
-
- fDocPageNum = fPagesInDoc = 1;
- SetInspectPage(fDocPageNum, fPagesInDoc);
- SetInspectShape(ePageShape, fPage);
- #endif // qUseQuickDrawGX
- }
-
- TGXDocWindow::~TGXDocWindow()
- {
- #if qUseQuickDrawGX
- short aCount = kMaxPageFormats;
- if (GetDocShape())
- GXDisposeShape(GetDocShape()); // Dispose of this doc's shape.
- if (GetDocJob())
- GXDisposeJob(GetDocJob()); // Dispose of this doc's print job.
- while (aCount--)
- if (fPageFormats[aCount])
- GXDisposeFormat(fPageFormats[aCount]);
-
- SetInspectPage(0, 0);
- SetInspectShape(ePageShape, nil);
- #endif // qUseQuickDrawGX
- }
-
- void TGXDocWindow::Select(void)
- {
- TDocWindow::Select();
- #if qUseQuickDrawGX
- SetInspectPage(fDocPageNum, fPagesInDoc);
- SetInspectShape(ePageShape, fPage);
- #endif // qUseQuickDrawGX
- }
-
- void TGXDocWindow::Activate(Boolean theIsActivating)
- {
- TDocWindow::Activate(theIsActivating);
- #if qUseQuickDrawGX
- if (theIsActivating)
- {
- SetInspectPage(fDocPageNum, fPagesInDoc);
- SetInspectShape(ePageShape, fPage);
- }
- #endif // qUseQuickDrawGX
- }
-
- void TGXDocWindow::Click(EventRecord* /*pEvent*/)
- {
- if (fWindow != FrontNonFloatingWindow())
- this->Select();
- }
-
- void TGXDocWindow::SetupMenus(void)
- {
- TDocWindow::SetupMenus();
- if (fPagesInDoc)
- {
- if (fDocPageNum < fPagesInDoc)
- EnableMenuItem(mEdit, iNextPage, true);
- if (fDocPageNum > 1)
- EnableMenuItem(mEdit, iPreviousPage, true);
- if (fPagesInDoc > 1)
- EnableMenuItem(mEdit, iGotoPage, true);
- }
- }
-
- void TGXDocWindow::AdjustCursor(EventRecord* pEvent)
- {
- Point aLocalMouse = pEvent->where;
- Rect aContentRect;
-
- GetContentRect(&aContentRect);
- {
- CSavePort aSavePort(fWindow);
-
- GlobalToLocal(&aLocalMouse);
- }
- #if qUseQuickDrawGX
- if (fPage && (fWindow == FrontNonFloatingWindow()))
- {
- if (PtInRect(aLocalMouse, &aContentRect))
- {
- Boolean aOptKey = ((pEvent->modifiers & optionKey) == optionKey);
- gxPoint aGXMouse;
- gxShapeAttribute aShapeAttribute;
- gxHitTestInfo aHitTestInfo;
- gxShape aTestPart = nil;
- // optionkey: squirrel down to LOWEST level
- short aLevel = (aOptKey ? 0 : 1);
- short aDepth = (aOptKey ? 0 : 1);
-
- aGXMouse.x = ff(aLocalMouse.h);
- aGXMouse.y = ff(aLocalMouse.v);
-
- GXIgnoreGraphicsNotice (attributes_already_set); // <<••
- GXIgnoreGraphicsNotice (transform_already_set); // <<••
- GXIgnoreGraphicsNotice (parameter_out_of_range); // <<••
- aShapeAttribute = GXGetShapeAttributes(fPage);
- GXSetShapeHitTest(fPage, gxGeometryPart, ff(0));
- // Getting grpahics ERROR: parameter_out_of_range
- // IM QD GX: Graphics pp 6-49,69
- aTestPart = GXHitTestPicture(fPage, &aGXMouse, &aHitTestInfo, aLevel, aDepth);
- GXSetShapeAttributes(fPage, aShapeAttribute);
- GXPopGraphicsNotice(); // <<•• parameter_out_of_range
- GXPopGraphicsNotice(); // <<•• transform_already_set
- GXPopGraphicsNotice(); // <<•• attributes_already_set
-
- if (aTestPart == nil)
- InitCursor();
- else
- SetCursor(*GetCursor(aOptKey ? 3 : 2));
-
- SetInspectShape(eTestShape, aTestPart);
- return;
- }
- SetInspectShape(eTestShape, nil);
- }
- #endif // qUseQuickDrawGX
- InitCursor();
- }
-
- #if READJOB
-
- OSErr TGXDocWindow::SavePrintInfo(MyDocumentPtr whichDocument, short resRefNum)
- {
- OSErr err;
- Handle thePrintData, oldPrintData;
- OSType dataResType;
- short dataResID;
-
- /*
- If QuickDraw GX is present, flatten the document's gxJob into a
- handle so that we can write it to disk. Otherwise, make a copy
- of the document's print handle. In either case, set up the
- resource type and ID to use. Notice how smoothly this makes
- the rest of the routine work. We don't need to worry about
- whether we're storing a gxJob or a print record to disk.
- */
-
- UseResFile(resRefNum);
-
- if (gGXIsPresent)
- {
- err = MySaveFormatRefs(whichDocument);
- nrequire(err, CouldNotSaveFormatRefs);
-
- thePrintData = NewHandle(0);
- GXFlattenJobToHdl(whichDocument->documentJob, thePrintData);
- err = GXGetJobError(whichDocument->documentJob);
- nrequire(err, CouldNotFlattenJob);
-
- dataResType = kMyJobType;
- dataResID = kMyJobID;
- }
- else
- {
- thePrintData = (Handle) whichDocument->documentPrintHdl;
- err = HandToHand(&thePrintData);
- nrequire(err, CouldNotDuplicatePrintHdl);
-
- dataResType = kMyPrintRecType;
- dataResID = kMyPrintRecID;
- }
-
- // If there's an existing resource, delete it.
-
- oldPrintData = Get1Resource(dataResType, dataResID);
-
- if (oldPrintData != nil)
- {
- RmveResource(oldPrintData);
- UpdateResFile(resRefNum);
- DisposHandle(oldPrintData);
- }
-
- // Add our new resource.
-
- AddResource(thePrintData, dataResType, dataResID, "\p");
- err = ResError();
- nrequire(err, CouldNotAddResource);
-
- WriteResource(thePrintData);
- UpdateResFile(resRefNum);
- DetachResource(thePrintData);
-
- CouldNotAddResource:
- DisposHandle(thePrintData);
-
- CouldNotDuplicatePrintHdl:
- CouldNotFlattenJob:
- CouldNotSaveFormatRefs:
- return err;
- }
-
- /************************************************************
- MyLoadPrintInfo - This routine loads our document's
- previously saved print record or gxJob data.
-
- *************************************************************/
-
- OSErr TGXDocWindow::LoadPrintInfo(MyDocumentPtr whichDocument, short resRefNum)
- {
- OSErr err = noErr;
- THPrint savedPrintHdl;
- Handle theJobData = nil;
-
- UseResFile(resRefNum);
-
- /*
- If we're using QuickDraw GX, and there's a job resource saved,
- load it and unflatten it. Any format references saved with a
- document are no longer valid, so we need to adjust them.
- */
- theJobData = Get1Resource(kMyJobType, kMyJobID);
-
- if (theJobData != nil)
- {
- GXUnflattenJobFromHdl(whichDocument->documentJob, theJobData);
- err = GXGetJobError(whichDocument->documentJob);
- ReleaseResource(theJobData);
-
- if (err == noErr)
- err = MyAdjustFormats(whichDocument);
- }
-
- /*
- If there was no job data saved or we're not using QuickDraw GX,
- try to load a previously saved print record. If we find one,
- and QuickDraw GX is being used, convert the print record to
- a gxJob. Otherwise, if we find one and QuickDraw GX is not
- being used, dispose of the print handle that we allocated in
- our MyCreateDocument routine.
-
- Note that if no gxJob or print record was previously saved,
- we'll simply end up using the one we created in our
- MyCreateDocument routine. So, no matter what, we'll always
- have a gxJob or print record to use!
- */
- if (theJobData == nil)
- {
- savedPrintHdl = (THPrint) Get1Resource(kMyPrintRecType, kMyPrintRecID);
-
- if (savedPrintHdl != nil)
- {
- DetachResource((Handle) savedPrintHdl);
-
- if (gGXIsPresent)
- {
- GXConvertPrintRecord(whichDocument->documentJob, savedPrintHdl);
- DisposeHandle((Handle) savedPrintHdl);
- err = GXGetJobError(whichDocument->documentJob);
- }
- else
- {
- DisposHandle((Handle) whichDocument->documentPrintHdl);
- whichDocument->documentPrintHdl = savedPrintHdl;
- }
- }
- }
-
- return err;
- }
- #endif // READJOB
-
- #define kSpoolBufSize (32*1024)
-
- OSErr TGXDocWindow::ReadPage(long thePageNum)
- {
- OSErr anErr = fnfErr;
- #if qUseQuickDrawGX
- TGXDocFile* aGxDocFile = (TGXDocFile*)fDocFile;
- if (aGxDocFile)
- {
- gxShape aPage;
-
- SetCursor(*GetCursor(watchCursor));
- anErr = aGxDocFile->ReadPageShape(thePageNum, &aPage, fContentViewPort);
- if (anErr == noErr)
- {
- {
- CSavePort aSavePort(fWindow);
- Rect aViewRect;
- GetContentRect(&aViewRect);
- InvalRect(&aViewRect);
- }
-
- GXDisposeShape(fPage);
- fPage = aPage;
- fDocPageNum = thePageNum;
- fPagesInDoc = aGxDocFile->DocNumOfPages();
- SetInspectPage(fDocPageNum, fPagesInDoc);
- SetInspectShape(ePageShape, fPage);
- }
- InitCursor();
- }
- #endif // qUseQuickDrawGX
- return anErr;
- }
-
- /*------ CreateSampleImage -----------------------------------------------------------------*/
- //
- // This function creates primitive shapes and adds them to the window's page shape.
- //
- void TGXDocWindow::CreateSampleImage(void)
- {
- #if qUseQuickDrawGX
- // DebugStr("\pCreateSampleImage");
- if (gQuickDrawGXClient)
- {
- gxShape aPageShape;
- gxShape aLineShape;
- gxLine aLineData = {{ff(25), ff(25)}, {ff(125), ff(125)}};
- gxShape aRectShape;
- gxRectangle aRectData = {ff(25), ff(25), ff(75), ff(75)};
- gxShape aCurveShape;
- gxCurve aCurveData = {{ff(25), ff(25)}, {ff(275), ff(75)}, {ff(125), ff(125)}};
- gxShape aPathShape;
- long a888Data[] = { 1 /* # of contours */,
- 6 /* # of points */,
- 0xff000000,
- 0, 0, // the points
- ff(75), 0,
- ff(5), ff(50),
- ff(75), ff(100),
- 0, ff(100),
- ff(75), ff(50)};
- gxShape aTextShape;
- gxRectangle aTextBounds;
- gxColor aTextColour;
- Fixed x,y;
- short loop;
- gxShape aPolygonShape;
- long aStarData[] = { 1, // number of contours
- 5 , // number of points
- ff(60), 0, ff(90), ff(90), ff(0), ff(30),
- ff(120), ff(30), ff(0), ff(90)}; // the points
-
-
- SetCursor(*GetCursor(watchCursor));
- // Retrieve the page shape so we can add to it.
- aPageShape = GetDocShape();
-
- // Create a line
- aLineShape = GXNewLine (&aLineData);
-
- AddToShape(aPageShape, aLineShape);
- GXDisposeShape(aLineShape);
-
-
- // Create a rectangle which is: red & is draw with it's frame.
- aRectShape = GXNewRectangle(&aRectData);
- SetShapeCommonColor (aRectShape, red);
- GXSetShapeFill (aRectShape, gxClosedFrameFill);
- GXMoveShapeTo (aRectShape, ff(150), ff(25));
-
- AddToShape(aPageShape, aRectShape);
- GXDisposeShape(aRectShape);
-
- // Create a curve which has: a 3.25 pen thickness
- aCurveShape = GXNewCurve(&aCurveData);
-
- // The fl marco converts floating gxPoint #'s to fixed gxPoint.
- GXSetShapePen(aCurveShape, fl(3.25));
- GXMoveShapeTo (aCurveShape, ff(210), ff(25));
-
- AddToShape(aPageShape, aCurveShape);
- GXDisposeShape(aCurveShape);
-
- // Create apath which has: a 2 pen thickness, its color is green, and its drawn with its frame
- aPathShape = GXNewPaths((gxPaths *) a888Data);
- GXSetShapeFill (aPathShape, gxClosedFrameFill);
- GXSetShapePen(aPathShape, ff(2));
- SetShapeCommonColor (aPathShape, green);
-
- GXMoveShapeTo (aPathShape, ff(390), ff(25));
-
- AddToShape(aPageShape, aPathShape);
- GXDisposeShape(aPathShape);
-
- // Create a character S which is: colored in hsv space and it is rotated 15 degrees - six times
- // via the left bottom corner. Create the text, set the font size, and set the font name
- aTextShape = GXNewText(1,(unsigned char*)"S", nil);
- SetShapeCommonFont(aTextShape, timesFont);
- GXSetShapeTextSize(aTextShape, ff(200));
- GXMoveShapeTo (aTextShape, ff(25), ff(275));
- GXSetShapeAttributes (aTextShape, (GXGetShapeAttributes(aTextShape) | gxMapTransformShape));
-
- // Create an hsv color space and set up the initial colors
- aTextColour.space = gxHSVSpace;
- aTextColour.profile = nil;
- aTextColour.element.hsv.hue = 0x7400;
- aTextColour.element.hsv.saturation = 0xFFFF;
- aTextColour.element.hsv.value = 0xFFFF;
-
- // Get the bounds of "aTextShape" and determine the bottom left corner
- GXGetShapeBounds(aTextShape, 0L, &aTextBounds);
- x = aTextBounds.left;
- y = aTextBounds.bottom;
-
- // Rotate "aTextShape" 15 degrees - 6 times. Add each letter to the picture.
- for (loop = 0; loop < 6; loop++)
- {
- GXSetShapeColor(aTextShape, &aTextColour);
- GXRotateShape(aTextShape, ff(15), x, y);
- AddToShape(aPageShape, aTextShape);
- aTextColour.element.hsv.hue += 0x0940;
- }
- GXDisposeShape(aTextShape);
-
- // Create a polygon which has the following features: yellow, drawn with a pen = 3, and
- // skew it in the vertical direction by 0.5
- aPolygonShape = GXNewPolygons((gxPolygons *) aStarData);
- GXSetShapeFill(aPolygonShape, gxEvenOddFill);
- GXSetShapePen (aPolygonShape, ff(3));
- SetShapeCommonColor (aPolygonShape, yellow);
- GXMoveShapeTo (aPolygonShape, ff(240), ff(110));
- GXSkewShape(aPolygonShape, 0, fl(0.5), 0, 0);
-
- AddToShape(aPageShape, aPolygonShape);
- GXDisposeShape(aPolygonShape);
- InitCursor();
- fDocPageNum = fPagesInDoc = 1;
- }
- SetInspectShape(ePageShape, fPage);
- SetInspectPage(fDocPageNum, fPagesInDoc);
- this->SetDirty(true);
- #endif // qUseQuickDrawGX
-
- // Invalidate the window's portRect so that everything gets updated.
- SetPort(fWindow);
- InvalRect(&fWindow->portRect);
- }
-
- void TGXDocWindow::GetContentRect(Rect* pRect)
- {
- *pRect = fWindow->portRect;
- pRect->top += kHeaderHeight;
- pRect->bottom -= kScrollbarWidth;
- pRect->right -=kScrollbarWidth;
- }
-
- #if qUseQuickDrawGX
- /*------ ResetContentClip ---------------------------------------------------------------------------*/
- // This utility routine resets the clipping of the child view port that the page shape (contents) is in.
- void TGXDocWindow::ResetContentClip(void)
- {
- Rect aPortRect;
- gxRectangle aContentRect;
- gxShape aContentClipShape;
-
- // Inset the shape...
- GetContentRect(&aPortRect);
- aContentRect.top = ff(aPortRect.top);
- aContentRect.bottom = ff(aPortRect.bottom);
- aContentRect.right = ff(aPortRect.right);
- aContentRect.left = ff(aPortRect.left);
- aContentClipShape = GXNewRectangle(&aContentRect);
- GXIgnoreGraphicsNotice(clip_already_set); // <<••
- GXSetViewPortClip(fContentViewPort, aContentClipShape);
- GXPopGraphicsNotice(); // <<••
- GXDisposeShape(aContentClipShape);
- }
- #endif // qUseQuickDrawGX
-
- void TGXDocWindow::AdjustForNewWindowSize(Rect* pOldSize,Rect* pNewSize)
- {
- Rect aScrollbarRect;
-
- // Erase the new vertical scroll bar
- if (pNewSize->right < pOldSize->right)
- if ((pNewSize->right - pNewSize->left) > kScrollbarWidth)
- {
- aScrollbarRect = *pNewSize;
- aScrollbarRect.top += kHeaderHeight;
- aScrollbarRect.bottom -= kScrollbarWidth;
- aScrollbarRect.left = aScrollbarRect.right - kScrollbarWidth;
- EraseRect(&aScrollbarRect);
- }
- // Erase the new horizontal scroll bar
- if (pNewSize->bottom < pOldSize->bottom)
- if ((pNewSize->bottom - pNewSize->top) > (kScrollbarWidth+kHeaderHeight))
- {
- aScrollbarRect = *pNewSize;
- aScrollbarRect.top = aScrollbarRect.bottom - kScrollbarWidth;
- aScrollbarRect.right -= kScrollbarWidth;
- EraseRect(&aScrollbarRect);
- }
- TDocWindow::AdjustForNewWindowSize(pOldSize, pNewSize);
- #if qUseQuickDrawGX
- this->ResetContentClip();
- #endif // qUseQuickDrawGX
- }
-
- void TGXDocWindow::Draw(void)
- {
- TDocWindow::Draw();
- #if qUseQuickDrawGX
- if (GetDocShape())
- {
- // Ref IM-DQ GX Objects pp 7-45,7-46
- this->ResetContentClip();
- GXDrawShape(GetDocShape());
- }
- #endif // qUseQuickDrawGX
- }
-
- void TGXDocWindow::HandleMenuCommand(short theMenuID, short theMenuItem)
- {
- Boolean aHandled = true;
- switch(theMenuID)
- {
- case mEdit :
- switch(theMenuItem)
- {
- case iNextPage:
- if (fDocPageNum < fPagesInDoc)
- ReadPage(fDocPageNum+1);
- break;
- case iPreviousPage:
- if (fDocPageNum > 1)
- ReadPage(fDocPageNum-1);
- break;
- case iGotoPage:
- break;
- default : aHandled = false; break;
- }
- break;
-
- default : aHandled = false; break;
- }
- if ( ! aHandled)
- TDocWindow::HandleMenuCommand(theMenuID, theMenuItem);
- }
-
- #define RepaginateDoc()
-
- void TGXDocWindow::PageSetupDlg(Boolean theCustomFlag)
- {
- #if qUseQuickDrawGX
- gxDialogResult aDialogResult;
- gxEditMenuRecord aEditMenuRecord;
-
- aEditMenuRecord.editMenuID = mEdit;
- aEditMenuRecord.cutItem = iCut;
- aEditMenuRecord.copyItem = iCopy;
- aEditMenuRecord.pasteItem = iPaste;
- aEditMenuRecord.clearItem = iClear;
- aEditMenuRecord.undoItem = iUndo;
-
- EnableAllMenus(false);
- if (theCustomFlag)
- {
- Boolean aNewPageFormat = (fPageFormats[fDocPageNum-1] == nil);
- gxFormat aPageFormat;
- // If we have an existing page format, we'll modify that.
- // Otherwise, we'll need to create a new format and use that.
- if (aNewPageFormat)
- {
- aPageFormat = GXNewFormat(fDocJob);
- if(GXGetJobError(fDocJob))
- aPageFormat = nil;
- }
- else
- aPageFormat = fPageFormats[fDocPageNum-1];
- if (aPageFormat)
- {
- aDialogResult = GXFormatDialog(aPageFormat, &aEditMenuRecord, nil);
- switch (aDialogResult)
- {
- case gxRevertSelected:
- // If the user selected "Remove", use the default job format with this page.
- // For our application, we indicate this by storing nil for the format reference in our structure.
- GXDisposeFormat(aPageFormat);
- fPageFormats[fDocPageNum-1] = nil;
- break;
- case gxOKSelected:
- fPageFormats[fDocPageNum-1] = aPageFormat;
- break;
- case gxCancelSelected:
- // If the user selected "Cancel", dispose of our cloned copy
- // of the default job format, if we made one.
- if (aNewPageFormat)
- GXDisposeFormat(aPageFormat);
- break;
- }
- if (aNewPageFormat)
- RepaginateDoc();
- }
- }
- else
- {
- aDialogResult = GXJobDefaultFormatDialog(fDocJob, &aEditMenuRecord);
- if (aDialogResult == gxOKSelected)
- RepaginateDoc();
- }
-
- EnableAllMenus(true);
-
- #endif // qUseQuickDrawGX
- }
-
- #define GXPrintLoop()
- void TGXDocWindow::PrintDlg(Boolean theDialogFlag)
- {
- #if qUseQuickDrawGX
- gxDialogResult aDialogResult;
- if (theDialogFlag)
- {
- gxEditMenuRecord aEditMenuRecord;
-
- aEditMenuRecord.editMenuID = mEdit;
- aEditMenuRecord.cutItem = iCut;
- aEditMenuRecord.copyItem = iCopy;
- aEditMenuRecord.pasteItem = iPaste;
- aEditMenuRecord.clearItem = iClear;
- aEditMenuRecord.undoItem = iUndo;
-
- EnableAllMenus(false);
- aDialogResult = GXJobPrintDialog(fDocJob, &aEditMenuRecord);
- EnableAllMenus(true);
- }
- else
- aDialogResult = gxOKSelected;
- if (aDialogResult == gxOKSelected)
- GXPrintLoop();
- #endif // qUseQuickDrawGX
- }
-
- #if qUseQuickDrawGX
- /*------ GetDocShape ---------------------------------------------------------------------------*/
- // This utility routine returns the page shape (contents) attached to a window's document.
- gxShape TGXDocWindow::GetDocShape(void)
- {
- return this->fPage;
- }
- #endif // qUseQuickDrawGX
-
- #if qUseQuickDrawGX
- /*------ GetDocJob -----------------------------------------------------------------------------*/
- // This utility routine returns the print job attached to a window's document.
- gxJob TGXDocWindow::GetDocJob(void)
- {
- return this->fDocJob;
- }
- #endif // qUseQuickDrawGX
-
-
-